<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .one {
            padding: 0px;
            background-color: #ff0000;
            margin-bottom: 50px;
        }

        .two {
            padding: 0px;
            background-color: #f0f;
            margin-top: 50px;
        }

        .three {
            padding: 0px;
            background-color: #3322ff;
            margin-right: 50px;
        }

        .four {
            padding: 0;
            background-color: #292;
            margin-left: 50px;
        }
        /*垂直方向上的margin会触发高度坍塌
        即上下两个元素的margin只会以较大的值为准
        而水平上的margin则没有这种现象*/
    </style>

</head>
<body>
<div class="one">AAAA</div>
<div class="two">BBBB</div>

<span class="three">CCCC</span>
<span class="four">DDDD</span>
</body>
</html>